
import Format from "@/utils/format";
// 引入 导航 Store Pinia
import useNavigator from "@/store/useNavigator";
export default function (router) {
    router.afterEach((to, from, failure) => {
        // if (failure) {
        //     let Message = failure?.msg || failure?.message;
        // } else {
        //     // 引入路由管理Store
        //     const NavigatorStore = useNavigator();
        //     // 当前路由对象
        //     let currentRoute = to;
        //     // 当前路由Meta对象
        //     let currentRouteMeta = currentRoute?.meta || {};
        //     // 找出祖先路由
        //     let Ancestors = Format.childIdGeTAncestorsId(
        //         NavigatorStore.GET_ROUTES,
        //         currentRouteMeta?.id
        //     );
        //     // 祖先路由Meta
        //     let AncestorsMeta = Ancestors?.meta || {};
        //     // 设置祖先路由
        //     NavigatorStore.SET_TOP_ROUTE(Ancestors);

        //     let list = Format.GraduallyRouter(
        //         NavigatorStore.GET_ROUTES,
        //         currentRouteMeta?.id
        //     );
        //     NavigatorStore.SET_ALONG_ROUTER(list.GraduallyList);

        //     NavigatorStore.SET_CURRENT_ROUTE(to);
        // }
    });
    router.onError((error) => {
        console.log("路由跳转失败");
        console.log(error);
        let {message} = error;
        if (message) {
            console.log(message);
        }
    });
}